/**
 * Created by lance on 2017/2/28.
 */

import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
import { Jsonp, URLSearchParams,Response } from '@angular/http';
import { Observable }   from 'rxjs/observable';
import 'rxjs/add/operator/catch';

@Injectable()
export class CollectService {
     constructor(private jsonp: Jsonp) {
  }

  collectde(collectid: string) {
    let collect = 'http://api.pinwu.net/site/coldetail';
    let params = new URLSearchParams();
    params.set('collectid', collectid);                 // the user's repwd
    params.set('callback', 'JSONP_CALLBACK');

    return this.jsonp
      .get(collect, {search: params})
      .map((res: Response) => {
        let result = res.json();
        console.log(result);
        return result;
      });
  }
}
